#ifndef __HEAD_H__
#define __HEAD_H__

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <linux/fb.h>
#include <fcntl.h>
#include <math.h>
#include <sys/stat.h>
#include <time.h>
#include <dirent.h>
#include <unistd.h>

typedef unsigned char u8_t;
typedef unsigned short u16_t;
typedef unsigned int u32_t;

typedef struct 
{
	int w;				  /* width */
	int h;				  /* high */
	int bpp;			/* bits per pixel */
	u8_t *fbmem;
}fb_info;

extern fb_info my_fb;
extern int length;
#define FB_DEVICE "/dev/fb0"

/* ***************** init.c *******************/

/* Initialize framebuffer */
extern int init();

/* ***************** draw.c *******************/

/* draw point */
extern int fb_pixel(short x, short y, u32_t color);		

/* ******************** jpeg.c ******************** */

/*This returns an array for a 24 bit image.*/
extern u8_t *decode_jpeg (const char *filename, fb_info *jpeg_inf);

/* ******************** transform.c ****************/
extern u32_t * rgb24to32(u8_t *buf24, fb_info jpeg_inf);

extern u16_t * rgb24to16(u8_t *buf24, fb_info jpeg_inf);

extern u8_t * scale24(u8_t *buf24, fb_info new_inf, fb_info jpeg_inf);


#if 1
/* ******************** disp_jpeg.c ******************** */
/* display jpeg */
extern int disp_jpeg_down(char *filename);

extern int disp_jpeg_up(char *filename);

extern int disp_jpeg_c(char *filename, int x, int y, int len);

extern int disp_jpeg_d(char *filename, int x, int y,int len);

//extern int disp_jpeg_1(char *filename);

extern int disp_jpeg_2(char *filename); 

extern int disp_jpeg_right(char *filename);

extern int disp_jpeg_left(char *filename);

extern int disp_jpeg_to_middle(char *filename);

extern int disp_jpeg_middle_to(char *filename);

extern int disp_jpeg_middle_side(char *filename); 

extern int disp_jpeg_center(char *filename);

extern int disp_jpeg_center_1(char *filname);

extern int disp_jpeg_center_2(char *filname);

extern int disp_jpeg_style1(char *filename);

extern int disp_jpeg_style2(char *filename);

extern int disp_jpeg_style3(char *filename);

extern int disp_jpeg_style4(char *filename);

extern int disp_jpeg_style5(char *filename);
#endif


#endif
